//
//  HOTCommTextField.m
//  Genpara
//
//  Created by AndyChang.zhang on 14-8-29.
//  Copyright (c) 2014年 zhangchh. All rights reserved.
//

#import "HOTCommTextField.h"

@interface HOTCommTextField() {
    
    CGRect txtBounds;
}

@end

@implementation HOTCommTextField

-(id)initWithFrame:(CGRect)frame {
    
    if(self = [super initWithFrame:frame]) {
        
        [self initView];
        
        return self;
    }
    
    return nil;
}

-(void)initView {
    
    UIImage *bgImage = [UIImage imageNamed:@"text_box"];
    bgImage = [bgImage resizableImageWithCapInsets:UIEdgeInsetsMake(20, 20, 20, 20)];
    
    [self setBorderStyle:UITextBorderStyleNone];
    self.background = bgImage;
    txtBounds = CGRectMake(20, 2, self.frame.size.width-30, 100);
    self.returnKeyType = UIReturnKeyDone;
    self.font = [UIFont fontWithName:kHOT_FONT_HIRAGINO_KAKU_W6 size:16];
    self.textColor = [UIColor blackColor];

}

-(void)awakeFromNib {
    
    [self initView];
}

#pragma mark - @over write
-(CGRect)editingRectForBounds:(CGRect)bounds{
    
    return CGRectMake(bounds.origin.x +20, bounds.origin.y +2, bounds.size.width-20, bounds.size.height);
}

- (CGRect)textRectForBounds:(CGRect)bounds {
    
    return CGRectMake(bounds.origin.x +20, bounds.origin.y +2, bounds.size.width-20, bounds.size.height);
}


-(void)setTextRectForBounds:(CGRect)bounds {
    
    txtBounds = bounds;
}




// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
//- (void)drawRect:(CGRect)rect
//{
//
//}
@end
